import axios from 'axios';

let host = 'http://192.168.12.13:8111/api';

// let host = '/api';
//登录
export const login = data => { return axios.post(`${host}/login/`, data) }


// 登录页校区信息处理
export const getSchoolInfo = params => { return axios.get(`${host}/school/`, params) }

// ================================= 校区 ========================================


// 获取举办校区信息
export const getSchoolListInfo = params => { return axios.get(`${host}/school/`, params) }

//编辑后校区信息更新
export const schoolListItemInfo = (id,data) => { return axios.patch(`${host}/school/${id}/`, data) }

// 新增校区
export const addSchoolInfo = data => { return axios.post(`${host}/school/`, data) }

// 删除校区信息
export const DeletSchoolInfo = (id, data) => { return axios.patch(`${host}/school/${id}/`, data) }

// ============ 用户 =================


// 获取用户列表信息
export const getUserListInfo = params => { return axios.get(`${host}/user/`, params) }


// 用户信息编辑后更新
export const userListItemInfo = (id,data) => { return axios.patch(`${host}/user/${id}/`, data) }


    
// 新增用户信息
export const addUserInfo = data => { return axios.post(`${host}/user/`, data) }


// 删除用户信息
export const DeletUserInfo = (id, data) => { return axios.patch(`${host}/user/${id}/`, data) }

// ============= 已付费学员 ===============

// 获取已付费学员
export const getPaidStuListInfo = params => { return axios.get(`${host}/student/`, params) }


// 学生信息编辑后更新
export const stuListItemInfo = (id,data) => { return axios.patch(`${host}/student/${id}/`, data) }

// 新增学生信息
export const addStuInfo = data => { return axios.post(`${host}/student/`, data) }

// 批量新增学生
export const batchAddStuInfo = data => { return axios.post(`${host}/student/batch_insertion/`, data) }

// 删除学生信息
export const DeletStuInfo = (id, data) => { return axios.delete(`${host}/student/${id}/`, data) }

// ============= 未付费学员 ===============
// 获取已付费学员
export const getUnPaidStuListInfo = params => { return axios.get(`${host}/student/`, params) }



// ============= 赛区 ===============
export const getAreaInfo = params => { return axios.get(`${host}/area/`, params) }
export const addAreaInfo = data => { return axios.post(`${host}/area/`, data) }
export const editAreaInfo = (id,data) => { return axios.patch(`${host}/area/${id}/`, data) }
export const deleteAreaInfo = (id,data) => { return axios.patch(`${host}/area/${id}/`, data) }



// ============= 赛季 ===============

// 获取举办赛季信息
export const getCompetitionInfo = params => { return axios.get(`${host}/competition/`, params) }

// 赛季信息编辑后更新
export const CompetitionListItemInfo = (id,data) => { return axios.patch(`${host}/competition/${id}/`, data) }

// 新增赛季信息
export const addCompetitionInfo = data => { return axios.post(`${host}/competition/`, data) }

// 删除赛季信息
export const deletCompetitionInfo = (id, data) => { return axios.patch(`${host}/competition/${id}/`, data) }

// ============= 分组 ===============


// 获取参赛学员分组信息
export const getStudentGroupInfo = params => { return axios.get(`${host}/student/grouping/`, params) }

// 获取分组信息
export const getGroupInfo = params => { return axios.get(`${host}/group/`, params) }

// 创建分组信息
export const createGroupInfo = data => { return axios.post(`${host}/group/`, data) }

// 修改分组信息
export const editGroupInfo = (uid,data) => { return axios.patch(`${host}/group/${uid}/`, data) }


